<template>
	<el-dialog :title="titleMap[mode]" v-model="visible" destroy-on-close @closed="$emit('closed')" align-center width="1200" fullscreen>
		<el-form :model="form" :rules="rules" ref="dialogForm" label-width="110px" label-position="right" style="height: 750px;">
            <el-container>
                <el-row :gutter="1">
                    <el-col :span="5">
                        <el-form-item label="项目编号" prop="project_code">
                            <el-input v-model="info.project_code" placeholder="请输入项目编号" disabled></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5">
                        <el-form-item label="客户名称" prop="customer_id">
                            <el-input v-model="info.customer_name" placeholder="请输入客户名称" disabled></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5">
                        <el-form-item label="会议名称" prop="metting">
                            <el-input v-model="info.metting" placeholder="请输入会议名称" disabled></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="项目日期" prop="project_time">
                            <el-date-picker v-model="info.project_time" type="date" placeholder="项目日期" style="width: 100%;" :value-format="'YYYY-MM-DD'" disabled></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="项目结束日期" prop="project_time">
                            <el-date-picker v-model="info.project_end_time" type="date" placeholder="结束日期" style="width: 100%;" :value-format="'YYYY-MM-DD'" disabled></el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="1">
                    <el-col :span="6">
                        <el-form-item label="类型" prop="type">
                            <el-select v-model="info.type" placeholder="请选择类型" style="width:100%" disabled>
                                <el-option v-for="item in typeList" :key="item.id" :label="item.title" :value="item.id"/>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="宴会厅" prop="banquet_id">
                            <el-input v-model="info.banquet_name" placeholder="请选择宴会厅" disabled></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="推介人" prop="recommend_id">
                            <el-input v-model="info.referrer_name" disabled placeholder="请选择推介人"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="项目总价" prop="total_price">
                            <el-input v-model="info.total_price" placeholder="请输入项目总价" type="number" disabled></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="1">
                    <el-col :span="6">
                        <el-form-item label="成本总额" prop="cost_all">
                            <el-input v-model="info.cost_all" disabled placeholder="成本总额"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="利润" prop="profit">
                            <el-input v-model="info.profit" placeholder="利润" type="number" disabled></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="利润率" prop="profit_margin">
                            <el-input v-model="info.profit_margin" placeholder="利润率" disabled>
                                <template #append>%</template>
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="是否开票" prop="is_ticket">
                            <el-switch v-model="info.is_ticket" :active-value="1" :inactive-value="0" disabled></el-switch>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-form-item label="备注" prop="remark">
                    <el-input v-model="info.remark" type="textarea" placeholder="请输入备注" disabled></el-input>
                </el-form-item>
                <el-header class="header-tabs" style="margin-bottom: 10px;">
                    <el-tabs type="card" v-model="groupId" @tab-change="tabChange">
                        <!-- <el-tab-pane label="项目详情" name="0"></el-tab-pane> -->
                        <el-tab-pane label="报价管理" :name="1"></el-tab-pane>
                        <el-tab-pane label="合同管理" :name="2"></el-tab-pane>
                        <el-tab-pane label="项目成本管理" :name="3"></el-tab-pane>
                        <el-tab-pane label="工作人员及提成" :name="4"></el-tab-pane>
                        <el-tab-pane label="备用金管理" :name="5"></el-tab-pane>
                        <el-tab-pane label="发票管理" :name="6"></el-tab-pane>
                        <el-tab-pane label="应收账款" :name="7"></el-tab-pane>
                        <el-tab-pane label="推介人提成管理" :name="8"></el-tab-pane>
                        <el-tab-pane label="酒店预售权管理" :name="9"></el-tab-pane>
                    </el-tabs>
                </el-header>
                <!-- 报价 -->
                <div v-if="groupId==1">
                    <el-header style="padding:0 15px;height: 40px;">
                        <div class="left-panel">
                            <el-button type="primary" @click="offerPush">提交</el-button>
                            <el-button type="primary" @click="getOfferList(offerform.id)">刷新</el-button>
                        </div>
                    </el-header>
                    <sc-form-table ref="table" class="formtable" v-model="offerform.alldata" :addTemplate="offerTemplate" placeholder="暂无数据" height="455" show-summary @tableAdd="offerTableAdd">
                        <el-table-column label="报价单编号" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.offer_code" readonly></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="报价金额" align="center" prop="offer_total">
                            <template #default="scope">
                                <el-input v-model="scope.row.offer_total" placeholder="报价金额"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="商品成本" align="center" prop="cost_total">
                            <template #default="scope">
                                <el-input v-model="scope.row.cost_total" placeholder="商品成本"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="附件" align="center">
                            <template #default="scope">
                                <sc-upload-file v-model="scope.row.offer_files">
                                    <el-button type="primary" size="small">上传文件</el-button>
                                </sc-upload-file>
                            </template>
                        </el-table-column>
                        <el-table-column label="备注" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.remark" placeholder="备注"></el-input>
                            </template>
                        </el-table-column>
                    </sc-form-table>
                </div>
                <!-- 合同管理 -->
                <div v-if="groupId==2">
                    <el-header style="padding:0 15px;height: 40px;">
                        <div class="left-panel">
                            <el-button type="primary" @click="contractPush">提交</el-button>
                            <el-button type="primary" @click="getOfferList(contractform.id)">刷新</el-button>
                        </div>
                    </el-header>
                    <sc-form-table ref="table" class="formtable" v-model="contractform.alldata" :addTemplate="contractTemplate" placeholder="暂无数据" height="455" show-summary @tableAdd="contractTableAdd">
                        <el-table-column label="合同编号" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.contract_code" readonly></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="销售" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.salesman" filterable clearable placeholder="请选择销售" style="width:100%">
                                    <el-option v-for="item in saletList" :key="item.id" :label="item.name" :value="item.id"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="附件" align="center">
                            <template #default="scope">
                                <sc-upload-file v-model="scope.row.contract_files">
                                    <el-button type="primary" size="small">上传文件</el-button>
                                </sc-upload-file>
                            </template>
                        </el-table-column>
                        <el-table-column label="备注" align="center" prop="price">
                            <template #default="scope">
                                <el-input v-model="scope.row.remark" placeholder="备注"></el-input>
                            </template>
                        </el-table-column>
                    </sc-form-table>
                </div>
                <!-- 项目成本 -->
                <div v-if="groupId==3">
                    <el-header style="padding:0 15px;height: 40px;">
                        <div class="left-panel">
                            <el-button type="primary" @click="costPush">提交</el-button>
                            <el-button type="primary" @click="getCostList(costform.id)">刷新</el-button>
                            <el-button type="warning" @click="batch_export" v-auth="'project.export'">导出</el-button>
                        </div>
                    </el-header>
                    <sc-form-table ref="table" class="formtable" v-model="costform.alldata" :addTemplate="costTemplate" placeholder="暂无数据" height="455" show-summary @tableAdd="costTableAdd">
                        <el-table-column label="商品名称" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.goods_id" placeholder="请选择商品" clearable filterable @change="goodsChange(scope.row)">
                                    <el-option v-for="item in goodsList" :key="item.id" :label="item.goods_name" :value="item.id"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="明细" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.detail" placeholder="明细"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="单价" align="center" prop="price">
                            <template #default="scope">
                                <el-input v-model="scope.row.price" placeholder="单价" @focus="onFocus($event)" @input="totalCalc"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="数量" align="center" prop="number">
                            <template #default="scope">
                                <el-input v-model="scope.row.number" placeholder="数量" @focus="onFocus($event)" @input="totalCalc"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="小计" align="center" prop="total">
                            <template #default="scope">
                                <el-input v-model="scope.row.total" placeholder="小计" readonly></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="结算周期" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.settlement" placeholder="请选择结算周期" style="width:100%" clearable filterable>
                                    <el-option label="月结" :value="0"/>
                                    <el-option label="现结" :value="1"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="是否结账" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.is_checkout" placeholder="请选择" style="width:100%" clearable filterable>
                                    <el-option label="已结" :value="1"/>
                                    <el-option label="未结" :value="0"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="供应商名称" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.supplier_id" placeholder="请选择供应商" clearable filterable style="color:red">
                                    <el-option v-for="item in scope.row.applyList" :key="item.id" :label="item.supplier_name" :value="item.id" />
                                </el-select>
                            </template>
                        </el-table-column>
                    </sc-form-table>
                </div>
                <!-- 工作人员提成 -->
                <div v-if="groupId==4">
                    <el-header style="padding:0 15px;height: 40px;">
                        <div class="left-panel">
                            <el-button type="primary" @click="royaltyPush">提交</el-button>
                            <el-button type="primary" @click="getRoyaltyList(royaltyform.id)">刷新</el-button>
                        </div>
                    </el-header>
                    <sc-form-table ref="table" class="formtable" v-model="royaltyform.alldata" :addTemplate="royaltyTemplate" placeholder="暂无数据" height="455" show-summary @tableAdd="royaltyTableAdd">
                        <el-table-column label="工作人员" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.salesman" filterable clearable placeholder="请选择工作人员" style="width:100%">
                                    <!-- <el-option v-for="item in saletList" :key="item.id" :label="item.name" :value="item.id"/> -->
                                    <el-option v-for="item in scope.row.saletList" :key="item.id" :label="item.name" :value="item.id"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="岗位" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.jobs_id" filterable clearable placeholder="请选择岗位" style="width:100%" @change="josChange(scope.row)">
                                    <el-option v-for="item in jobList" :key="item.id" :label="item.name" :value="item.id"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="利润" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.profit" readonly></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="利润率" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.profit_margin" readonly></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="提成比例" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.commission_ratio" readonly placeholder="提成比例"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="提成金额" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.commission_money" readonly placeholder="提成金额"></el-input>
                            </template>
                        </el-table-column>
                    </sc-form-table>
                </div>
                <!-- 备用金 -->
                <div v-if="groupId==5">
                    <el-header style="padding:0 15px;height: 40px;">
                        <div class="left-panel">
                            <el-button type="primary" @click="imprestPush">提交</el-button>
                            <el-button type="primary" @click="getImprestList(imprestform.id)">刷新</el-button>
                        </div>
                    </el-header>
                    <sc-form-table ref="table" class="formtable" v-model="imprestform.alldata" :addTemplate="imprestTemplate" placeholder="暂无数据" height="455" show-summary @tableAdd="imprestTableAdd" :hideAdd="imprestform.alldata.length">
                        <el-table-column label="申请单号" align="center">
                            <template #default="scope">
                                <!-- <el-input v-model="scope.row.reserve_code" readonly></el-input> -->
                                <el-link type="primary" style="font-size:12px" @click="table_reserve(scope.row)">{{ scope.row.reserve_code }}</el-link>
                            </template>
                        </el-table-column>
                        <el-table-column label="申请事由" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.apply_reason" placeholder="申请事由"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="申请金额" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.apply_money" placeholder="申请金额"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="申请人" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.apply_people" filterable clearable placeholder="请选择申请人" style="width:100%">
                                    <el-option v-for="item in saletList" :key="item.id" :label="item.name" :value="item.id"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="申请时间" align="center">
                            <template #default="scope">
                                <el-date-picker v-model="scope.row.apply_time" type="date" placeholder="申请时间" style="width: 100%;" :value-format="'YYYY-MM-DD'" disabled></el-date-picker>
                            </template>
                        </el-table-column>
                        <el-table-column label="核销凭证" align="center">
                            <template #default="scope">
                                <sc-upload-multiple width='50' height='50' v-model="scope.row.verification_voucher" draggable></sc-upload-multiple>
                            </template>
                        </el-table-column>
                        <el-table-column label="申请状态" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.apply_status" placeholder="请选择申请状态" style="width:100%" disabled>
                                    <el-option label="已通过" :value="1"/>
                                    <el-option label="未通过" :value="0"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="核销状态" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.verification_status" placeholder="请选择核销状态" style="width:100%">
                                    <el-option label="未核销" :value="0"/>
                                    <el-option label="核销完成" :value="1"/>
                                </el-select>
                            </template>
                        </el-table-column>
                    </sc-form-table>
                </div>
                <!-- 发票管理 -->
                <div v-if="groupId==6">
                    <el-header style="padding:0 15px;height: 40px;">
                        <div class="left-panel">
                            <el-button type="primary" @click="invoicePush">提交</el-button>
                            <el-button type="primary" @click="getInvoiceList(invoiceform.id)">刷新</el-button>
                        </div>
                    </el-header>
                    <sc-form-table ref="table" class="formtable" v-model="invoiceform.alldata" :addTemplate="invoiceTemplate" placeholder="暂无数据" height="455" show-summary @tableAdd="invoiceTableAdd" @tableDel="costcomputed">
                        <el-table-column label="客户" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.customer_id" filterable clearable placeholder="请选择客户" style="width:100%" @change="custonChange(scope.row)" disabled>
                                    <el-option v-for="item in customList" :key="item.id" :label="item.company_name" :value="item.id"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="客户抬头" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.open_data_id" filterable clearable placeholder="请选择客户抬头" style="width:100%" @change="customTitleChange(scope.row)">
                                    <el-option v-for="item in open_data" :key="item.id" :label="item.customer_rise" :value="item.id"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="抬头类型" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.titleType" placeholder="抬头类型" disabled></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="开票类型" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.openType" placeholder="开票类型" disabled></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="纳税人识别号" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.taxpayer_num" placeholder="纳税人识别号" disabled></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="开户行" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.open_bank" placeholder="开户行" disabled></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="开户账号" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.open_bank_account" placeholder="开户账号" disabled></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="开票金额" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.money" placeholder="开票金额" @input="costcomputed"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="开票内容" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.invoice_content" placeholder="请选择开票内容" style="width:100%"  clearable>
                                    <el-option label="会议会展服务" :value="0"/>
                                    <el-option label="设备租赁" :value="1"/>
                                    <el-option label="摄影摄像服务" :value="2"/>
                                    <el-option label="广告物料制作" :value="3"/>
                                    <el-option label="广告印刷" :value="4"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="开票主体" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.company_id" placeholder="请选择开票主体" style="width:100%"  clearable>
                                    <el-option v-for="item in companyList" :key="item.id" :label="item.company_name" :value="item.id"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="上传凭证" align="center">
                            <template #default="scope">
                                <sc-upload-file v-model="scope.row.voucher">
                                    <el-button type="primary" size="small">上传文件</el-button>
                                </sc-upload-file>
                            </template>
                        </el-table-column>
                        <el-table-column label="审核状态" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.status" placeholder="请选择审核状态" style="width:100%" disabled>
                                    <el-option label="待审核" :value="0"/>
                                    <el-option label="审核通过" :value="1"/>
                                    <el-option label="审核拒绝" :value="2"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="电话" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.phone" placeholder="电话" clearable></el-input>
                            </template>
                        </el-table-column>
                        <!-- <el-table-column label="税率" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.rate" placeholder="税率" clearable></el-input>
                            </template>
                        </el-table-column> -->
                    </sc-form-table>
                </div>
                <!-- 应收账款 -->
                <div v-if="groupId==7">
                    <el-header style="padding:0 15px;height: 40px;">
                        <div class="left-panel">
                            <el-button type="primary" @click="receivablePush">提交</el-button>
                            <el-button type="primary" @click="getReceivableList(receivableform.id)">刷新</el-button>
                        </div>
                    </el-header>
                    <sc-form-table ref="table" class="formtable" v-model="receivableform.alldata" :addTemplate="receivableTemplate" placeholder="暂无数据" height="455" show-summary @tableAdd="receivableTableAdd">
                        <el-table-column label="应收金额" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.collect_account" placeholder="应收金额"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="已回金额" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.return_account" placeholder="已回金额" readonly></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="未回金额" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.not_account" placeholder="未回金额" readonly></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="回款状态" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.collect_status" placeholder="请选择回款状态" style="width:100%">
                                    <el-option label="未回款" :value="1"/>
                                    <el-option label="部分回款" :value="2"/>
                                    <el-option label="回款完成" :value="3"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="未回款说明" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.not_remark" placeholder="未回款说明"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="计划回款时间" align="center">
                            <template #default="scope">
                                <el-date-picker v-model="scope.row.plan_time" type="date" placeholder="计划回款时间" style="width: 100%;" :value-format="'YYYY-MM-DD'"></el-date-picker>
                            </template>
                        </el-table-column>
                        <el-table-column label="操作" align="center">
                            <template #default="scope">
                                <el-button type="success" size="small" v-if="scope.row.collect_status != 1" @click="table_record(scope.row)" v-auth="'receivable.record'">回款记录</el-button>
                            </template>
                        </el-table-column>
                    </sc-form-table>
                </div>
                <!-- 推介人 -->
                <div v-if="groupId==8">
                    <el-header style="padding:0 15px;height: 40px;">
                        <div class="left-panel">
                            <el-button type="primary" @click="referrerPush">提交</el-button>
                            <el-button type="primary" @click="getReferrerList(referrerform.id)">刷新</el-button>
                        </div>
                    </el-header>
                    <sc-form-table ref="table" class="formtable" v-model="referrerform.alldata" :addTemplate="referrerTemplate" placeholder="暂无数据" height="455" show-summary @tableAdd="referrerTableAdd">
                        <el-table-column label="推介人" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.recommend_name" placeholder="推介人" readonly></el-input>
                            </template>
                        </el-table-column>
                        <!-- <el-table-column label="项目利润" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.project_profit" placeholder="项目利润" readonly></el-input>
                            </template>
                        </el-table-column> -->
                        <el-table-column label="提成比例" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.commission_ratio" placeholder="提成比例" @input="count(scope.row)"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="提成金额" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.commission_money" placeholder="提成金额"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="创建时间" align="center">
                            <template #default="scope">
                                <!-- {{moment(scope.row.apply_time * 1000).format('YYYY-MM-DD')}} --><!-- 时间戳 -->
                                <el-date-picker v-model="scope.row.create_time" type="date" placeholder="创建时间" style="width: 100%;" :value-format="'YYYY-MM-DD'"></el-date-picker>
                            </template>
                        </el-table-column>
                    </sc-form-table>
                </div>
                <!-- 酒店 -->
                <div v-if="groupId==9">
                    <el-header style="padding:0 15px;height: 40px;">
                        <div class="left-panel">
                            <el-button type="primary" @click="hotelPush">提交</el-button>
                            <el-button type="primary" @click="getHotelList(hotelform.id)">刷新</el-button>
                        </div>
                    </el-header>
                    <sc-form-table ref="table" class="formtable" v-model="hotelform.alldata" :addTemplate="hotelTemplate" placeholder="暂无数据" height="455" show-summary @tableAdd="hotelTableAdd">
                        <el-table-column label="预售金额" align="center">
                            <template #default="scope">
                                <el-input v-model="scope.row.pre_sale" placeholder="预售金额"></el-input>
                            </template>
                        </el-table-column>
                        <el-table-column label="拍照上传" align="center">
                            <template #default="scope">
                                <sc-upload-multiple width='50' height='50' v-model="scope.row.photo_files" draggable></sc-upload-multiple>
                            </template>
                        </el-table-column>
                        <el-table-column label="预售状态" align="center">
                            <template #default="scope">
                                <el-select v-model="scope.row.pre_status" placeholder="请选择预售状态" style="width:100%" clearable>
                                    <el-option label="预售中" :value="0"/>
                                    <el-option label="已退款" :value="1"/>
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column label="创建时间" align="center">
                            <template #default="scope">
                                <el-date-picker v-model="scope.row.create_time" type="date" placeholder="创建时间" style="width: 100%;" :value-format="'YYYY-MM-DD'" disabled></el-date-picker>
                            </template>
                        </el-table-column>
                    </sc-form-table>
                </div>
            </el-container>
		</el-form>
	</el-dialog>
    <verification v-if="dialog.verifica" ref="verificaDialog" @success="handleSuccess" @closed="dialog.verifica = false" draggable :query="{reserve_fund_id: reserve_fund_id}"></verification>
    <pay-list v-if="dialog.list" ref="listDialog" @success="handleSuccess" @closed="dialog.list = false" :query="{project_code:listId}"></pay-list>
</template>

<script>
import verification from '../Imprest/verification.vue'
import PayList from '../receivable/payList.vue'
export default {
  components: { verification, PayList },
	emits: ['success', 'closed'],
    props:{
        query: { type: String, default: "" },
    },
	data() {
		return {
            color:"#F00",
			mode: "add",
			titleMap: {
				add: '新增项目',
				edit: '编辑项目',
				show: '项目详情'
			},
			visible: false,
			isSaveing: false,
            dialog:{
                verifica:false
            },
            groupId: 1,
            form:{
                id:"",
            },
            // 项目详情
			info: {
                project_code:"",
				customer_id: "",
                metting:"",
                project_time: "",
                project_end_time: "",
                type:"",
                banquet_id:"",
                recommend_id:"",
                total_price:"",
                is_ticket:"",
                remark:"",
                cost_all:"",
                profit:"",
                profit_margin:"",
                customer_name:"",
                banquet_name:"",
                referrer_name:"",
			},
            typeList:[
                {id:1,title:"会议"},
                {id:2,title:"婚礼"},
                {id:3,title:"会议代收"},
                {id:4,title:"会议代收+自付"},
                {id:5,title:"赞助"},
            ],
            costform:{              //成本数据
                id:"",
                alldata:[],
            },
            costTemplate:{},
            contractform:{          //合同数据
                id:"",
                alldata:[],
            },
            contractTemplate:{},
            goodsList:[],           //商品
            applyList:[],           //供应商
            offerform:{             //报价数据
                id:"",
                alldata:[],
            },
            saletList:[],           // 销售
            offerTemplate:{},
            royaltyform:{           //报价数据
                id:"",
                alldata:[],
            },
            jobList:[],
            royaltyTemplate:{},
            imprestform:{           //备用金数据
                id:"",
                alldata:[],
            },
            reserve_fund_id:"",
            imprestTemplate:{},
            customList:[],          //客户
            companyList:[],         //开票主体
            invoiceform:{           //开票数据
                id:"",
                alldata:[],
            },
            invoiceTemplate:{},
            open_data: [],
            receivableform:{        //应收账款数据
                id:"",
                alldata:[],
            },
            receivableTemplate:{},
            referrerform:{          //推介人数据
                id:"",
                alldata:[],
            },
            referrerTemplate:{},
            hotelform:{             //酒店数据
                id:"",
                alldata:[],
            },
            hotelTemplate:{},
            rateData:[],            //比例
            listId: "",
            invoice_count: "",
		}
	},
	mounted() {
        this.getGoods()
        // this.getApply()
        // this.getUser()
        this.getJobs()
        this.getCompany()
	},
	methods: {
        table_record() {
            this.listId = this.info.project_code
			this.dialog.list = true
			this.$nextTick(() => {
				this.$refs.listDialog.open('add')
			})
		},
        //显示
		open(mode = 'add') {
			this.mode = mode;
			this.visible = true;
			return this
		},
		//表单注入数据
		async setData(data) {
            this.form.id = data.id
            this.getOfferList(data.id)          //报价
            this.offerform.id = data.id
            // this.getContractList(data.id)       //合同
            // this.contractform.id = data.id
            // this.getCostList(data.id)           //项目成本
            // this.costform.id = data.id
            // this.getRoyaltyList(data.id)        //工作人员提成
            // this.royaltyform.id = data.id
            // this.getImprestList(data.id)        //备用金
            // this.imprestform.id = data.id
            // this.getInvoiceList(data.id)        //发票
            // this.invoiceform.id = data.id
            // this.getReceivableList(data.id)     //应收账款
            // this.receivableform.id = data.id
            // this.getReferrerList(data.id)       //推介人
            // this.referrerform.id = data.id
            // this.getHotelList(data.id)          //酒店
            // this.hotelform.id = data.id
            this.info.project_code = data.project_code
            this.info.customer_id = data.customer_id
            this.info.metting = data.metting
            this.info.project_time = data.project_time
            this.info.project_end_time = data.project_end_time
            this.info.type = Number(data.type)
            this.info.banquet_id = data.banquet_id
            this.info.recommend_id = data.recommend_id
            this.info.total_price = data.total_price
            this.info.cost_all = data.cost_all
            this.info.profit = data.profit
            this.info.profit_margin = data.profit_margin
            this.info.is_ticket = data.is_ticket
            this.info.remark = data.remark
            this.info.customer_name = data.customer&&data.customer.company_name
            this.info.banquet_name = data.banquet&&data.banquet.banquet_name
            this.info.referrer_name = data.recommend&&data.recommend.recommend_name
            this.custonChange(data.customer_id)
		},
        // 获取报价数据
        async getOfferList(e){
            var res = await this.$API.project.offer.all.get({project_id:e});
            let offer = []
            res.data.map(item=>{
                offer.push({
                    id:item.id,
                    project_id:e,
                    offer_code:item.offer_code,
                    offer_total:item.offer_total,
                    cost_total:item.cost_total,
                    offer_files:item.offer_files,
                    remark:item.remark,
                })
            })
            this.offerform.alldata = offer;
        },
        // 报价加按钮点击
        offerTableAdd(data){
            data.map(item=>{
                item.project_id = this.offerform.id
                item.offer_code = item.offer_code?item.offer_code:""
            })
        },
        // 报价提交
        async offerPush(){
            var res = await this.$API.project.offer.allAdd.post(this.offerform);
            this.isSaveing = false;
            if (res.code == 1) {
                this.$message.success("操作成功")
                this.getOfferList(this.offerform.id)
            } else {
                this.$alert(res.message, "提示", { type: 'error' })
            }
        },
        /**----------------------------------------------------------------------------------------------------- */
        // 获取项目成本数据
        async getCostList(e){
            var res = await this.$API.project.itemcost.all.get({project_id:e});
            let goods = []
            res.data.map(item=>{
                this.goodsChange(item)
                goods.push({
                    id:item.id,
                    project_id:e,
                    goods_id:item.goods_id,
                    detail:item.detail,
                    price:item.price,
                    number:item.number,
                    total:(Number(item.price) * Number(item.number)).toFixed(2),
                    settlement:item.settlement,
                    is_checkout:item.is_checkout,
                    supplier_id:Number(item.supplier_id),
                    reserve_fund_id:item.reserve_fund_id,
                })
            })
            this.costform.alldata = goods;
        },
        // 项目成本加按钮点击
        costTableAdd(data){
            data.map(item=>{
                if(!item.id){
                    item.project_id = this.costform.id
                    item.reserve_fund_id = ''
                }
            })
        },
        // 成本计算
        totalCalc(){
            let count = 0
            this.costform.alldata.map(item=>{
                if(item.price && item.number){
                    item.total = (Number(item.price) * Number(item.number)).toFixed(2)
                    count = count + Number(item.price) * Number(item.number)
                }
            })
            this.info.cost_all = (count).toFixed(2)
            this.info.profit = (this.info.total_price - this.info.cost_all).toFixed(2)
            this.info.profit_margin = ((Number(this.info.profit) / Number(this.info.total_price))*100).toFixed(2)
        },
        // 项目成本提交
        async costPush(){
            var res = await this.$API.project.itemcost.allAdd.post(this.costform);
            this.isSaveing = false;
            if (res.code == 1) {
                this.$message.success("操作成功")
                this.getCostList(this.costform.id)
                var detail = await this.$API.project.project.detail.get({id:this.costform.id});
                this.info.total_price = detail.data.total_price
                this.info.cost_all = detail.data.cost_all
                this.info.profit = detail.data.profit
                this.info.profit_margin = detail.data.profit_margin                
            } else {
                this.$alert(res.message, "提示", { type: 'error' })
            }
        },
        async batch_export(){
            var res = await this.$API.project.itemcost.export_all.post({project_id:this.form.id})
            if (res.code == 1) {
                const fileUrl = res.data.url;
                const link = document.createElement("a");
                link.href = fileUrl;
                link.download = fileUrl;
                link.click();
            } else {
                this.$alert(res.message, "提示", { type: "error" });
            }
        },
        /**----------------------------------------------------------------------------------------------------- */
        // 获取合同数据
        async getContractList(e){
            var res = await this.$API.project.contract.all.get({project_id:e});
            let contract = []
            res.data.map(item=>{
                contract.push({
                    id:item.id,
                    project_id:e,
                    contract_code:item.contract_code,
                    salesman:Number(item.salesman),
                    contract_files:item.contract_files,
                    remark:item.remark,
                })
            })
            this.contractform.alldata = contract;
        },
        // 合同加按钮点击
        contractTableAdd(data){
            data.map(item=>{
                item.project_id = this.contractform.id
                item.contract_code = item.contract_code?item.contract_code:""
            })
        },
        // 报价提交
        async contractPush(){
            var res = await this.$API.project.contract.allAdd.post(this.contractform);
            this.isSaveing = false;
            if (res.code == 1) {
                this.$message.success("操作成功")
                this.getContractList(this.contractform.id)
            } else {
                this.$alert(res.message, "提示", { type: 'error' })
            }
        },
        /**----------------------------------------------------------------------------------------------------- */
        // 获取工作人员数据
        async getRoyaltyList(e){
            var res = await this.$API.project.royalty.all.get({project_id:e});
            let royalty = []
            res.data.map((item,index)=>{
                royalty.push({
                    id:item.id,
                    index: index,
                    project_id:e,
                    jobs_id:item.jobs_id,
                    salesman:item.salesman!=0?Number(item.salesman):'',
                    profit: item.jobs_id!=2? this.info.profit:'',
                    profit_margin:item.jobs_id!=2?this.info.profit_margin:'',
                    commission_ratio:item.commission_ratio,
                    commission_money:item.jobs_id!=2?((this.info.profit/100) * Number(item.commission_ratio)).toFixed(2):((item.commission_ratio/100) * Number(this.info.total_price)).toFixed(2),
                    saletList: [],
                })
                setTimeout(()=>{
                    this.getAdmin(item,index)
                },100)
            })
            this.royaltyform.alldata = royalty;
        },
        async getAdmin(row,index){
            row.index = index;
            var res = await this.$API.system.admin.all.get({jobs_id: row.jobs_id});
            row.saletList = res.data;
            this.royaltyform.alldata.find(item=>item.index==row.index).saletList = res.data;
        },
        // 工作人员加按钮点击
        royaltyTableAdd(data){
            data.map(item=>{
                item.project_id = this.royaltyform.id
                if(item.profit != ''){
                    item.profit = this.info.profit
                    item.profit_margin = this.info.profit_margin
                }
            })
        },
        // 工作人员提交
        async royaltyPush(){
            var res = await this.$API.project.royalty.allAdd.post(this.royaltyform);
            this.isSaveing = false;
            if (res.code == 1) {
                this.$message.success("操作成功")
                this.getRoyaltyList(this.royaltyform.id)
            } else {
                this.$alert(res.message, "提示", { type: 'error' })
            }
        },
        /**----------------------------------------------------------------------------------------------------- */
        // 获取备用金数据
        async getImprestList(e){
            var res = await this.$API.project.Imprest.all.get({project_id:e});
            let imprest = []
            res.data.map(item=>{
                imprest.push({
                    id:item.id,
                    project_id:e,
                    reserve_code:item.reserve_code,
                    apply_reason:item.apply_reason,
                    apply_people:Number(item.apply_people),
                    apply_money:item.apply_money,
                    verification_money:item.verification_money,
                    not_verification_money:item.not_verification_money,
                    apply_status:item.apply_status,
                    apply_time:this.moment(item.apply_time * 1000).format('YYYY-MM-DD'),
                    verification_status:item.verification_status,
                })
            })
            this.imprestform.alldata = imprest;
        },
        // 备用金加按钮点击
        imprestTableAdd(data){
            data.map(item=>{
                item.project_id = this.imprestform.id
                item.reserve_code = item.reserve_code?item.reserve_code:""
                item.apply_status = 0
                item.apply_time = item.apply_time?item.apply_time:this.moment().format('YYYY-MM-DD')
            })
        },
        // 备用金提交
        async imprestPush(){
            var res = await this.$API.project.Imprest.allAdd.post(this.imprestform);
            this.isSaveing = false;
            if (res.code == 1) {
                this.$message.success("操作成功")
                this.getImprestList(this.imprestform.id)
            } else {
                this.$alert(res.message, "提示", { type: 'error' })
            }
        },
        /**----------------------------------------------------------------------------------------------------- */
        // 获取发票数据
        async getInvoiceList(e){
            var res = await this.$API.project.invoice.all.get({project_id:e});
            let invoice = []
            res.data.map(item=>{
                invoice.push({
                    id:item.id,
                    project_id:e,
                    customer_id:Number(item.customer_id),
                    open_data:item.open_data,
                    open_data_id:Number(item.open_data_id),
                    company_id:Number(item.company_id),
                    money:item.money,
                    voucher:item.voucher,
                    remark:item.remark,
                    status:item.status,
                    phone:item.phone,
                    rate:item.rate,
                    titleType : item.opendata && item.opendata.rise_type == 0 ? "个人" : "单位",
                    openType : item.opendata && item.opendata.openType==1 ? "增值税纸质专票" : item.opendata && item.opendata.open_type==2 ? "增值税纸质普票" : item.opendata && item.opendata.open_type==3 ? "增值税电子普票" : "增值税电子专票",
                    taxpayer_num : item.opendata && item.opendata.taxpayer_num,
                    open_bank : item.opendata && item.opendata.open_bank,
                    open_bank_account : item.opendata && item.opendata.open_bank_account,
                    invoice_content : item.invoice_content,
                })
                
            })
            this.invoiceform.alldata = invoice;
            this.getCustomer()
        },
        // 发票加按钮点击
        invoiceTableAdd(data){
            data.map(item=>{
                if(!item.id){
                    item.project_id = this.invoiceform.id
                    item.status = 0,
                    item.customer_id = this.info.customer_id?this.info.customer_id:0
                }
            })
            this.custonChange()
        },
        // 发票提交
        async invoicePush(){
            let title = true
            let money = true
            let content = true
            let a = this.$TOOL.data.get("USER_INFO").role_id
            let voucher = true
            // if(a && a.includes(7)){
            //     this.rules.voucher[0].required = true
            // }
            this.invoiceform.alldata.map(item=>{
                if(!item.titleType){
                    title = false
                }
                if(!item.money){
                    money = false
                }        
                if(!item.company_id){
                    content = false
                }
                if(!item.voucher && a && a.includes(7)){
                    voucher = false
                }
            })
            if(!title){
                this.$alert('请选择客户抬头', "提示", { type: 'error' })
                return
            }
            if(!money){
                this.$alert('请填写开票金额', "提示", { type: 'error' })
                return
            }
            if(!content){
                this.$alert('请选择开票体', "提示", { type: 'error' })
                return
            }
            if(!voucher){
                this.$alert('请上传发票凭证', "提示", { type: 'error' })
                return
            }
            let price = (this.info.total_price * 0.5)+this.info.total_price
            if(this.invoice_count > price){
                this.$alert("开票金额不能大于50%的项目金额", "提示", { type: 'error' })
                return
            }else if(this.invoice_count > this.info.total_price){
                this.$confirm(`开票金额大于项目金额,确定继续操作吗？`, '提示', {
                    type: 'warning'
                }).then(() => {
                    console.log('可以超添加');
                    this.invSub()
                }).catch(() => {})
            }else {
                console.log('可以随意添加');
                this.invSub()
            }
            // if(Number(this.invoice_count) > Number(this.info.total_price)){
            //     this.$alert('开票金额不能超过项目总价,请检查', "提示", { type: 'error' })
            //     return
            // }
            
        },
        async invSub(){
            var res = await this.$API.project.invoice.allAdd.post(this.invoiceform);
            this.isSaveing = false;
            if (res.code == 1) {
                this.$message.success("操作成功")
                this.getInvoiceList(this.invoiceform.id)
            } else {
                this.$alert(res.message, "提示", { type: 'error' })
            }
        },
        /**----------------------------------------------------------------------------------------------------- */
        // 获取应收账款数据
        async getReceivableList(e){
            var res = await this.$API.project.receivable.all.get({project_id:e});
            let receivable = []
            res.data.map(item=>{
                receivable.push({
                    id:item.id,
                    project_id:e,
                    collect_account:item.collect_account,
                    return_account:item.return_account,
                    not_account:item.not_account,
                    collect_status:item.collect_status,
                    not_remark:item.not_remark,
                    plan_time:item.plan_time,
                })
                
            })
            this.receivableform.alldata = receivable;
        },
        // 应收账款加按钮点击
        receivableTableAdd(data){
            data.map(item=>{
                item.project_id = this.receivableform.id
            })
        },
        // 应收账款提交
        async receivablePush(){
            var res = await this.$API.project.receivable.allAdd.post(this.receivableform);
            this.isSaveing = false;
            if (res.code == 1) {
                this.$message.success("操作成功")
                this.getReceivableList(this.receivableform.id)
            } else {
                this.$alert(res.message, "提示", { type: 'error' })
            }
        },
        /**----------------------------------------------------------------------------------------------------- */
        // 获取推介人数据
        async getReferrerList(e){
            var res = await this.$API.project.referrer.all.get({project_id:e});
            let referrer = []
            res.data.map(item=>{
                referrer.push({
                    id:item.id,
                    project_id:e,
                    commission_ratio:item.commission_ratio,
                    create_time:item.create_time,
                    recommend_name:this.info.referrer_name,
                    // project_profit:this.info.profit,
                    // commission_money:(this.info.total_price * Number(item.commission_ratio / 100)).toFixed(2)
                    commission_money:item.commission_money == 0 ? (this.info.total_price * Number(item.commission_ratio / 100)).toFixed(2) : item.commission_money
                })
            })
            this.referrerform.alldata = referrer;
        },
        // 推介人加按钮点击
        referrerTableAdd(data){
            data.map(item=>{
                item.project_id = this.referrerform.id
                item.recommend_name = this.info.referrer_name,
                item.project_profit = this.info.profit,
                item.commission_ratio = item.commission_ratio?item.commission_ratio:10
                item.commission_money = (this.info.profit * Number(item.commission_ratio / 100)).toFixed(2)
                item.create_time = item.create_time?item.create_time:this.moment().format('YYYY-MM-DD')
            })
        },
        // 推介人提交
        async referrerPush(){
            var res = await this.$API.project.referrer.allAdd.post(this.referrerform);
            this.isSaveing = false;
            if (res.code == 1) {
                this.$message.success("操作成功")
                this.getReferrerList(this.referrerform.id)
            } else {
                this.$alert(res.message, "提示", { type: 'error' })
            }
        },
        /**----------------------------------------------------------------------------------------------------- */
        // 获取酒店数据
        async getHotelList(e){
            var res = await this.$API.project.hotel.all.get({project_id:e});
            let hotel = []
            res.data.map(item=>{
                hotel.push({
                    id:item.id,
                    project_id:e,
                    pre_sale:item.pre_sale,
                    pre_status:item.pre_status,
                    photo_files:item.photo_files,
                    create_time:item.create_time,
                })
                
            })
            this.hotelform.alldata = hotel;
        },
        // 酒店加按钮点击
        hotelTableAdd(data){
            data.map(item=>{
                item.project_id = this.hotelform.id
                item.create_time = item.create_time?item.create_time:this.moment().format('YYYY-MM-DD')
            })
        },
        // 酒店提交
        async hotelPush(){
            var res = await this.$API.project.hotel.allAdd.post(this.hotelform);
            this.isSaveing = false;
            if (res.code == 1) {
                this.$message.success("操作成功")
                this.getHotelList(this.hotelform.id)
            } else {
                this.$alert(res.message, "提示", { type: 'error' })
            }
        },
        // 数据更新
        handleSuccess(data, mode) {
			if (mode == 'add') {
				this.$refs.table.refresh()
			} else if (mode == 'edit') {
				this.$refs.table.refresh()
			}
		},
        onFocus(event){
            event.target.select();
        },
        // 商品
        async getGoods(){
            var res = await this.$API.product.list.all.get();
            this.goodsList = res.data;
        },
        async goodsChange(row){
            this.goodsList.map(item=>{
                if(item.id == row.goods_id){
                    row.supplier = item.supplier_id
                }
            })
            // if(!isNaN(row.supplier)){
                var res = await this.$API.apply.apply.all.get({supplier_id:row.supplier});
                row.applyList = res.data
                this.costform.alldata.map(item=>{
                    if(item.goods_id == row.goods_id){
                        item.applyList = res.data
                    }
                })
            // }
        },
        // 供应商
        async getApply(e){
            var res = await this.$API.apply.apply.all.get({supplier_id:e});
            this.applyList = res.data;
        },
        // 销售
        async getUser(){
            var res = await this.$API.system.admin.all.get();
            this.saletList = res.data;
        },
        // 岗位
        async getJobs(){
            var res = await this.$API.system.jobs.list.get();
            this.jobList = res.data;
        },
        josChange(row){
            row.commission_ratio = ''
            row.commission_money = ''
            this.jobList.map(item=>{
                if(row.jobs_id == item.id){
                    this.rateData = item.job_rate
                }
            })
            if(row.jobs_id!=2){
                row.profit = this.info.profit
                row.profit_margin = this.info.profit_margin
                for (let i = 0; i < this.rateData.length; i++) {
                    if (row.profit_margin > this.rateData[i].big && row.profit_margin <= this.rateData[i].small) {
                        row.commission_ratio = this.rateData[i].rate
                    }else if(this.rateData[i].big ==0 && this.rateData[i].small == 0){
                        row.commission_ratio = this.rateData[i].rate
                    }
                }
                row.commission_money = (Number(row.profit / 100) * row.commission_ratio).toFixed(2)
            }else{
                row.profit = ''
                row.profit_margin = ''
                row.commission_ratio = 1
                row.commission_money = Number(this.info.total_price) * 0.01
            }
            this.getAdmin(row)
        },
        // 客户
        async getCustomer(){
            var res = await this.$API.client.client.all.get();
            this.invoiceform.alldata.map(item=>{
                res.data.map(item1=>{
                    if(item.customer_id == item1.id){
                        item.open_data = item1.open_data
                    }
                })
            })
            this.customList = res.data;
        },
        // 客户抬头
        async getCustomTitle(){
            var res = await this.$API.client.invoice.all.get();
            this.open_data = res.data;
        },
        // 开票主体
        async getCompany(){
            var res = await this.$API.finance.company.all.get();
            this.companyList = res.data;
        },
        // 选择客户切换抬头
        async custonChange(){
            var res = await this.$API.client.invoice.all.get({customer_id:this.info.customer_id});
            this.open_data = res.data;
            // row.open_data_id = ''
            // row.titleType = ''
            // row.openType = ''
            // row.axpayer_num = ''
            // row.open_bank = ''
            // row.open_bank_account = ''
        },
        // 切换抬头
        customTitleChange(row){
            this.open_data.map(item=>{
                if(row.open_data_id == item.id){
                    row.titleType = item.rise_type == 0 ? "个人" : "单位",
                    row.openType = item.openType==1 ? "增值税纸质专票" : item.open_type==2 ? "增值税纸质普票" : item.open_type==3 ? "增值税电子普票" : "增值税电子专票",
                    row.axpayer_num = item.taxpayer_num,
                    row.open_bank = item.open_bank,
                    row.open_bank_account = item.open_bank_account
                }else{
                    row.titleType = ''
                    row.openType = ''
                    row.axpayer_num = ''
                    row.open_bank = ''
                    row.open_bank_account = ''
                }
            })
        },
        costcomputed(){
            let count = 0
            this.invoiceform.alldata.map(item => {
                if(item.money){
                    count = count + Number(item.money)
                }
            });
            this.invoice_count = count
        },
        // 推介人提成计算
        count(row){
            if(row.commission_ratio){
                row.commission_money = (this.info.total_price * Number(row.commission_ratio / 100)).toFixed(2)
            }
        },
        table_reserve(row) {
            let projectInfo = {
                project_id: this.form.id,
                reserve_fund_id: row.id,
                project_code: this.info.project_code,
                project_name: this.info.metting,
                project_time: this.info.project_time,
            }
            this.reserve_fund_id = row.id
			this.dialog.verifica = true
			this.$nextTick(() => {
				this.$refs.verificaDialog.open('edit').projectData(projectInfo)
			})
		},
        tabChange(e){
            if(e == 1){
                this.getOfferList(this.form.id)          //报价
                this.offerform.id = this.form.id
            }else if(e == 2){ 
                this.getContractList(this.form.id)       //合同
                this.contractform.id = this.form.id
            }else if(e == 3){ 
                this.getCostList(this.form.id)           //项目成本
                this.costform.id = this.form.id
            }else if(e == 4){
                this.getRoyaltyList(this.form.id)        //工作人员提成
                this.royaltyform.id = this.form.id
            }else if(e == 5){ 
                this.getImprestList(this.form.id)        //备用金
                this.imprestform.id = this.form.id
            }else if(e == 6){
                this.getInvoiceList(this.form.id)        //发票
                this.invoiceform.id = this.form.id
            }else if(e == 7){
                this.getReceivableList(this.form.id)     //应收账款
                this.receivableform.id = this.form.id
            }else if(e == 8){
                this.getReferrerList(this.form.id)       //推介人
                this.referrerform.id = this.form.id
            }else if(e == 9){
                this.getHotelList(this.form.id)          //酒店
                this.hotelform.id = this.form.id
            }
        },
	}
}
</script>

<style></style>
